package fast.loader;

import java.util.ArrayList;
import java.util.List;

import fast.data.Stat;
import fast.data.StatBlock;

public class Gem extends StatBlock {
	
	public static final int META = 6;
	public static final int RED = 0;
	public static final int ORANGE = 5;
	public static final int PURPLE = 3;
	public static final int BLUE = 1;
	public static final int GREEN = 4;
	public static final int YELLOW = 2;
	public static final int HYDRAULIC = 9;
	public static final int COGWHEEL = 10;
	
	private int type = 0; // 1 = meta, 2 = red, 4 = orange, 8 = purple
		
	private int id;
	private String name;
	private String icon;
	private int reqSkill;
	private int quality;
	private double ep;
	private String gearBuff;
	
	public static Socket[] SocketColors = { 
		null, // 0
		Socket.meta, // 1
		Socket.red,	// 2
		null, 
		Socket.yellow, // 4
		null, 
		null,
		null,
		Socket.blue,	// 8
		null,
		null,
		null,
		null,
		null,
		Socket.prismatic,	// 14
		null,
		Socket.hydraulic,
		null,
		null,
		null,
		null,
		null,
		null,
		null,
		null,
		null,
		null,
		null,
		null,
		null,
		null,
		null,
		Socket.cogwheel, // 32
	};
	
	public static int[] Colors = { 
		Gem.RED, Gem.BLUE, Gem.YELLOW, Gem.PURPLE, Gem.GREEN, Gem.ORANGE, Gem.META, 0, 0, Gem.HYDRAULIC, Gem.COGWHEEL
	};
	
	
	public Gem(){
		//
	}
	
	public Gem(int id, String name,String icon,int type,int a,int h,int ha,int ma){
		this.setId(id);
		this.setName(name);
		this.setIcon(icon);
		this.type = type;
		setStat(Stat.agi, a);
		setStat(Stat.hit, h);
		setStat(Stat.hst, ha);
		setStat(Stat.mst, ma);
	}
	
	public int getType(){
		return type;
	}
	
	public String toString(){
		List<String> elems = new ArrayList<String>();
		for(Stat stat : Stat.possibleStats ){
			if(this.getStat(stat) > 0)
				elems.add(String.format("%+.0f", this.getStat(stat)) + " " + stat.getName());
		}
		StringBuilder sb = new StringBuilder();
		for(String elem : elems){
			sb.append(elem);
			if(!elems.get(elems.size()-1).equals(elem))
				sb.append(" / ");
		}
		return sb.toString();
	}

	public String getName() {
		return this.name;
	}

	public void setIcon(String icon) {
		this.icon = icon;
	}

	public String getIcon() {
		return icon;
	}

	public void setName(String name) {
		this.name = name;
	}

	public void setId(int id) {
		this.id = id;
	}

	public int getId() {
		return id;
	}

	public void setType(int int1) {
		this.type = int1;
	}

	public void setReqSkill(int reqSkill) {
		this.reqSkill = reqSkill;
	}

	public int getReqSkill() {
		return reqSkill;
	}
	
	public void setQuality(int quality) {
		this.quality = quality;
	}
	public int getQuality() {
		return quality;
	}

	public void setEP(double ep) {
		this.ep = ep;
	}

	public double getEP() {
		return ep;
	}

	public String getGearBuff() {
		return gearBuff;
	}

	public void setGearBuff(String gearBuff) {
		this.gearBuff = gearBuff;
	}
}
